package com.pkk.penguin.frame.know.shiro.shirodemo.springversion.mapper;


import com.pkk.penguin.frame.know.shiro.shirodemo.springversion.entity.TbUserEntity;
import com.pkk.penguin.frame.know.shiro.shirodemo.springversion.entity.resource.ResourceRole;
import com.pkk.penguin.frame.know.shiro.shirodemo.springversion.entity.role.RoleEntity;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;


/**
 * @author peikunkun<br>
 * @versio V1.0<br>
 * @Title: a<br>
 * @Description: <a>2018/8/22 00222上午 10:19/8/22 0022 上 10:19<br>
 * @URL:[a]
 */
@Mapper
public interface TbUserMapper {

  int insertSelective(TbUserEntity record);

  TbUserEntity selectByPrimaryKey(Long id);

  int updateByPrimaryKeySelective(TbUserEntity record);


  /**
   * @Description: 根据账户获取用户信息
   * @Param: a
   * @return: a
   * @Author: peikunkun
   * @Date: 2018/8/22 0022 下午 5:33
   */
  TbUserEntity selectUserInfoByName(String uName);

  /**
   * @Description: 根据账户id获取用户信息
   * @Param: a
   * @return: a
   * @Author: peikunkun
   * @Date: 2018/8/22 0022 下午 5:33
   */
  TbUserEntity selectUserInfoById(Long id);

  /**
   * @Description: 更新用户最后登录时间
   * @Param: [id]
   * @return: java.lang.Integer
   * @Author: peikunkun
   * @Date: 2018/8/23 0023 下午 1:21
   */
  Integer updateUserLastLoginTimeById(Long id);

  /**
   * @Description: 查询当前用户的角色
   * @Param: [userId]
   * @return: java.util.List<com.pkk.com.pkk.penguin.frame.know.shiro.shirodemo.springversion.entity.user.RoleEntity>
   * @Author: peikunkun
   * @Date: 2018/8/29 0029 下午 1:16
   */
  // TODO: 2018/8/29 0029 看一下需不需要加Param注解
  List<RoleEntity> selectUserRoleByUserId(Long userId);

  /**
   * @Description: 查询当前用户的角色
   * @Param: [userId]
   * @return: java.util.List<com.pkk.com.pkk.penguin.frame.know.shiro.shirodemo.springversion.entity.user.RoleEntity>
   * @Author: peikunkun
   * @Date: 2018/8/29 0029 下午 1:16
   */
  List<RoleEntity> selectUserRoleByUserName(String userName);

  List<ResourceRole> getAllResource();

  List<ResourceRole> getAllResourceByRoles(Long[] roles);
}